package com.example.comon.utils;

import com.example.comon.domain.LoginUser;

/**
 * 用户工具类
 * 获取当前请求的用户、设置当前请求的用户
 */
public class UserUtil {

    //线程本地变量
    private static ThreadLocal<LoginUser> userThreadLocal = new ThreadLocal<LoginUser>();


    public static LoginUser getLoginUser( ){
        LoginUser loginUser=  userThreadLocal.get();
        return loginUser;
    }

    public static void setLoginUser(LoginUser loginUser){
        userThreadLocal.set(loginUser);
    }
}
